﻿using Business.BookManagement;
using Business.BookManagement.Dto;
using Business.ProductManager;
using Business.ProductManager.Dto;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Domain.Repositories;

namespace Business.Controllers
{
    [RemoteService]
    [Area("Business")]
    [Route("api/business/product")]
    public class ProductController : AbpController
    {
        private readonly IProductAppService _ProductAppService;

        public ProductController(IProductAppService ProductAppService)
        {
            _ProductAppService = ProductAppService;
        }
        [HttpPost]
        [Route("data-post")]
        public Task<ProductDto> CreateOrUpdate(CreateOrUpdateProductDto input)
        {
            
            return _ProductAppService.CreateOrUpdate(input);
        }

        [HttpPost]
        [Route("delete")]
        public Task Delete(List<Guid> ids)
        {
            return _ProductAppService.Delete(ids);
        }
        [HttpGet]
       
        public Task<PagedResultDto<ProductDto>> GetAll(GetProductInputDto input)
        {
            return _ProductAppService.GetAll(input);
        }

        [HttpGet]
        [Route("{id}")]
        public Task<ProductDto> Get(Guid id)
        {
            return _ProductAppService.Get(id);
        }
    }
}
